<?php 
/*************************************************************************************
 * dbaccess.php
 * -----------
 * phpGMapTrips 
 * 
 * This php application allows you to easily record your travel destinations 
 * and display them with Google maps.
 * 
 * Author: Stephane Coste (lescoste@gmail.com)
 * Copyright: (c) 2006 Stephane Coste (http://lescoste.net/)
 * Release Version: 0.1
 * CVS Revision Version: $Revision: 1.14 $
 * Date Started: 2006/02/19
 * Last Modified: $Date: 2007/03/08 20:44:29 $
 *
 *************************************************************************************
 *
 *     This file is part of phpGMapTrips.
 *
 *   phpGMapTrips is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   phpGMapTrips is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with phpGMapTrips; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 ************************************************************************************/
?>
<?php 
/*
xml data exemple
TODO write xml schema or DTD
<points>
<point name="Hearst castle" lat="35.685053" long="-121.168213"  url="http://homeip.net/gallery/californie91" trips="California"><moreinfo name="date">20061201</moreinfo><moreinfo name="address">paris france</moreinfo>
<photos> <photo url="http://homeip.net/albums/californie91/Hearst_castle.thumb.jpg" /> </photos>
</point>
</points>


<trips>
<trip name="tunisie" groups="Africa; north africa"> 
<point name="" seq="1" /> // if the name is filled use it to find the lat/long else use lat/long
<point name="" seq="2" lat="" long=""/>
<point name="" seq="3" />
</trip>
</trips>

*/
//error_reporting(E_ALL);
include_once("config.php");
include_once("utils.php");
include_once("gps.php");

$tb = array(); // current point
$phs = array(); // current photo array
$ph = array(); // current photo
$phindex = 0; // photo index
$xmltagvalue = ""; // current xml tag 
$currentMoreInfo = "";
$ct = array(); // current trip

$db_grouparray = array(); // trips array : key = group name, value = list of trips

$db_triparray = array(); // trips array : key = trip, value = number of points
$db_tripNamearray = array(); // trips array : key = trip, value = nice trip name
$db_pointarray = array(); // points array : key = point name, value = point attributes array
$db_datearray = array(); // points array : key = date, value = point attributes array
$db_opttripseqarray = array(); // optional trips array : key = trip, value = points array : key = point sequence number, value = point attributes array
$optdb_triparray = array(); // optional trips array : key = trip, value = points array : key = point name, value = point attributes array
$tripname = ""; // which trip are we looking at
$findlatest = false; // are we looking for the lastest points
$isOptParsed = false;

$alltrips = array(); // list the trips that have been included in the special "All" trip

$loadAllNames = false;
$rootname = "";
$pointsNames = array(); // all point names
$editedPoint = array(); // point values
$editedTrip = array(); // trip values

if (empty($f_files)) {
	$f_files = urldecode($_GET["file"]);
	if (empty($f_files)) {
		$f_files = $_POST["file"];
	}
}

// which db plugin do we use for this map
if (empty($f_files)) {
	$plugindb = "dbxml";
} else {
	$plugindb = $extramapsParams[ "plugindb".$f_files];
}
include_once("plugindb/".$plugindb.".php");

if (empty($f_files)) {
	$f_files = "mespoints.xml";
} else {
	$f_files = "mes".$f_files.".xml";
}
$f_trips = $f_files."_trips.xml";
//echo "<!-- $f_files -->";

if (empty($tripname)) {
	$tripname = urldecode($_GET["showtrip"]);
	if (empty($tripname)) {
		$tripname = $_POST["showtrip"];
	}
}

?>
